<div class="{{$viewClass['form-group']}} {!! !$errors->hasAny($errorKey) ? '' : 'has-error' !!}">
    <label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
    <div class="{{$viewClass['field']}} form-inline">
        <div class="col-lg-2 ">
            <div class="vs-radio-con vs-radio-primary" style="margin-right: 16px">
                <input name="distpicker_nationwide" class=" Dcat_Admin_Widgets_Radio"
                       type="radio" {{empty($value['city'])?'checked':''}} value="1"/>
                <span class="vs-radio vs-radio-">
                    <span class="vs-radio--border"></span>
                    <span class="vs-radio--circle"></span>
                </span>
                <span>全国</span>
            </div>

        </div>

        <div class="col-lg-8 d-flex flex-wrap">
            <div class="vs-radio-con vs-radio-primary " style="text-align: right">
                <input name="distpicker_nationwide" class=" _normal_ Dcat_Admin_Widgets_Radio"
                       type="radio" {{!empty($value['city'])?'checked':''}}  value="2"/>
                <span class="vs-radio vs-radio-">
                    <span class="vs-radio--border"></span>
                    <span class="vs-radio--circle"></span>
                </span>
            </div>

            <div class="col-lg-11">
                @foreach($errorKey as $key => $col)
                    @if($errors->has($col))
                        @foreach($errors->get($col) as $message)
                            <label class="control-label" for="inputError">
                                <i class="fa fa-times-circle-o"></i> {{$message}}
                            </label>
                            <br/>
                        @endforeach
                    @endif
                @endforeach
                <div id="{{ $id }}" {!! $attributes !!}>
                    @foreach($name as $viewClass)
                        <select class="form-control" name="{{$viewClass}}"></select>&nbsp;
                    @endforeach
                </div>
                @include('admin::form.help-block')
            </div>
        </div>
    </div>
</div>

<script>
    // 定义一个函数来更新 select 元素的禁用状态
    function updateProvinceSelect() {
        // 获取选中的 radio 的值
        var isNationwide = $('input[name="distpicker_nationwide"]:checked').val() === "1";

        var $provinceSelect = $('select[name="region_province"]');
        var $region_city = $('select[name="region_city"]');
        var $region_region = $('select[name="region_region"]');

        $provinceSelect.prop('disabled', isNationwide);
        $region_city.prop('disabled', isNationwide);
        $region_region.prop('disabled', isNationwide);
        // 如果选中的值为 1，则清空 select 的选中值
        if (isNationwide) {
            $provinceSelect.val('');
            $region_city.val('');
            $region_region.val('');
        }
    }

    // 页面初始化时更新 select 元素的禁用状态
    updateProvinceSelect();
    // 当 name 为 distpicker_nationwide 的 radio 发生变化时，执行函数
    $('input[name="distpicker_nationwide"]').on('change', function () {
        updateProvinceSelect();
    });
</script>

